<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Request;
use think\Validate;

class Adv extends Base
{
    /**
     * 获取广告
     */
    public function getAdv(){
        $dat = input();

//        $user = $this -> vyUser($dat);//身份验证
//        if(isset($user['status'])){
//            return json($user);
//        }
        $validate = new Validate([
            "spaceid" => "require",
        ],
            [
                "spaceid.require" => "广告id不能为空",
            ]
        );

        if(!$validate->check($dat)){
            return json(['status'=>0,'msg'=>$validate->getError()]);
        }

        $sel_adv = Db::name('city_advertising')
            ->where(['space_id '=>$dat['spaceid']])
            ->find();

        return json(['status'=>200,'msg'=>'拉取成功','data'=>$sel_adv]);


    }

}